package univ.paris.ouest.validator;


import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import univ.paris.ouest.command.AthentificationCommand;

public class AthentificationValidator implements Validator {

	@Override
	public boolean supports(Class clazz) {
		return AthentificationCommand.class.isAssignableFrom(clazz);
	}

	@Override
	public void validate(Object obj, Errors errors) {
		//AthentificationCommand o=(AthentificationCommand)obj;
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "required.email","Field email is required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "pwd", "required.pwd","Field pwd is required");
	}
	
	

}
